package Servers

import (
	. "SGNet"
	. "Servers/BaseServer"
)

const (
	CommonID_ClientLost       = 0
	CommonID_NewGameScene     = 1
	CommonID_DestoryGameScene = 2
	CommonID_PlayerBackToHall = 3
)

var id2Server map[uint16]int

func init() {
	id2Server := make(map[uint16]int)
	id2Server[CommonID_ClientLost] = 0
}

func GetServerID(msgId uint16) int {
	return id2Server[msgId]
}
func CommondMessage(id uint16, params ...interface{}) *Message {
	retMessage := &Message{}
	retMessage.Type = MessageType_Command
	retMessage.Id = id
	retMessage.Param = make(map[string]interface{})
	//0 1 2 3
	for i := 0; i < len(params); i += 2 {
		retMessage.Param[params[i].(string)] = params[i+1]
	}
	return retMessage
}
